﻿CREATE TABLE [dbo].[Clients] (
    [ClientId]          INT            IDENTITY (1, 1) NOT NULL,
    [ClientName]        NVARCHAR (MAX) NOT NULL,
    [HourlyBillingRate] DECIMAL (7, 2) NOT NULL,
    [BillingTermsId]    INT            NOT NULL,
    [BillingCycleId]    INT            NOT NULL,
    CONSTRAINT [PK_Clients] PRIMARY KEY CLUSTERED ([ClientId] ASC),
    CONSTRAINT [FK_ClientBillingTerm] FOREIGN KEY ([BillingTermsId]) REFERENCES [dbo].[BillingTerms] ([BillingTermsId]) ON DELETE NO ACTION ON UPDATE NO ACTION,
    CONSTRAINT [FK_Clients_BillingCycle] FOREIGN KEY ([BillingCycleId]) REFERENCES [dbo].[BillingCycle] ([BillingCycleId]) ON DELETE NO ACTION ON UPDATE NO ACTION
);


GO
CREATE NONCLUSTERED INDEX [IX_FK_ClientBillingTerm]
    ON [dbo].[Clients]([BillingTermsId] ASC);

